<?php if($error == false) {?>

<table width="1028px" style="width:1028px">
	<tbody>
		<tr>
			<td width="100%">
				<table align="center" width="100%">
					<tbody>
						<tr>
							<td valign="top" style="text-align:left; vertical-align:top" width="30%">
								<b>TESRENG FEDERAL PAINT COMPANY</b><br>
								Tel: 012 855 424 - 097 97 37 222<br>
								Email: tesreng@gmail.com
							</td>
							<td valign="top" style="text-align:center; vertical-align:top" width="70%">
								<h2 style="padding:5px; margin-bottom:10px">ORDER LIST REPORT</h2>
								<div style="clear:both"></div>
								<div style="text-align:left">
									<table>
										<tr>
											<td style="text-align:center"><?php echo $this->document->text['text_date']?>: From <?php echo $search_fromdate?><?php echo $this->document->text['text_to']?><?php echo $search_todate?></td>
										</tr>
										<tr>
											<td style="text-align:center"><?php echo $this->document->text['text_ordertype']?>: <?php echo $search_ordertypedisplay?></td>
										</tr>
									</table>
								</div>
								<div style="clear:both"></div>
							</td>
						</tr>
					</tbody>
				</table>
				<table class="grid" style="width:1028px" align="center" cellpadding="5" cellspacing="0">
					<thead style="font-weight:bold">
						<th width="28px">No.</th>
						<th width="90px"><?php echo $this->document->text['text_type']?></th>
						<th width="80px"><?php echo $this->document->text['text_creator']?></th>
                        <th width="50px"><?php echo $this->document->text['text_orderno']?></th>
						<th width="50px"><?php echo $this->document->text['text_date']?></th>
						<th width="70px"><?php echo $this->document->text['text_ordertotal']?></th>
						<th width="60px"><?php echo $this->document->text['text_barcode']?></th>
						<th width="120px"><?php echo $this->document->text['text_product']?></th>
						<th width="40px"><?php echo $this->document->text['text_unit']?></th> 
						<th width="40px"><?php echo $this->document->text['text_qty']?></th>
						<th width="50px"><?php echo $this->document->text['text_price']?></th>
						<th width="70px"><?php echo $this->document->text['text_totalproducts']?></th>
						<th width="90px"><?php echo $this->document->text['text_customersupplier']?></th>
						<th width="90px"><?php echo $this->document->text['text_address']?></th>
						<th width="40px"><?php echo $this->document->text['text_phone']?></th>
						<th width="60px"><?php echo $this->document->text['text_note']?></th>
					</thead>
					<tbody>
						<?php
							$index = 0;
							foreach($orders as $order)
							{
								$index += 1;
						?>
									<tr>
										<td><?php echo $index?></td>
										<td><?php echo $ordertypename[$order['ordertype']]?></td>
										<td><?php echo $order['creatorname']?></td>
										<td><?php echo $order['ordernumber']?></td>
										<td style="text-align:center"><?php echo $this->date->formatMySQLDate($order['orderdate'])?></td>
										<td class="calc" style="text-align:right"><?php echo $order['grandtotal']?></td>
										<td><?php echo $order['product_barcode']?></td>
										<td><?php echo $order['product_productname']?></td>
										<td><?php echo $order['product_unit']?></td>
										<td style="text-align:center"><?php echo $order['product_qty']?></td>
										<td class="calc" style="text-align:right"><?php echo $order['product_orderprice']?></td>
										<td class="calc" style="text-align:right"><?php echo $order['product_grandtotal']?></td>
										<td><?php echo $order['note']?></td>
										<td><?php echo $order['partner_fullname']?></td>
										<td><?php echo $order['partner_address']?></td>
										<td><?php echo $order['partner_phone']?></td>                    
									</tr>
						<?php
							}
						?>
					
					</tbody>
				</table>
				<br>
				
				
			</td>
		</tr>
	</tbody>
	
</table>


<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:10pt}
table{font-size:11pt}
table th{font-weight:bold; text-align:left}
.grid th, .grid td {font-size:10pt}
.grid td{ border:1px dotted #CCCCCC}
.grid th{ text-align:center; border:1px dotted #999999}
.sign td{width:25%; text-align:center; font-weight:bold}
</style>

<script src="<?php echo DIR_JS?>jquery.js" type="text/javascript"></script>
<script>
	$(document).ready(function(){
		$(".calc").each(function(){
			num = formateNumber($(this).html().replace(/,/g,""));
			$(this).html(num);
		});
		window.print();
	});
</script>

<?php } else  {?>
<h1>Occur Error!</h1>
<?php } ?>

